home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / include / sys / RCS / socket.h,v < prev    next >
Text File  |  1989-07-14  |  5KB  |  212 lines

  1. head     1.3;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.3
  10. date     89.07.14.09.15.29;  author rab;  state Exp;
  11. branches ;
  12. next     1.2;
  13.  
  14. 1.2
  15. date     88.06.29.14.48.11;  author ouster;  state Exp;
  16. branches ;
  17. next     1.1;
  18.  
  19. 1.1
  20. date     88.06.21.12.01.44;  author ouster;  state Exp;
  21. branches ;
  22. next     ;
  23.  
  24.  
  25. desc
  26. @@
  27.  
  28.  
  29. 1.3
  30. log
  31. @*** empty log message ***
  32. @
  33. text
  34. @/*
  35.  * Copyright (c) 1982, 1985, 1986 Regents of the University of California.
  36.  * All rights reserved.
  37.  *
  38.  * Redistribution and use in source and binary forms are permitted
  39.  * provided that this notice is preserved and that due credit is given
  40.  * to the University of California at Berkeley. The name of the University
  41.  * may not be used to endorse or promote products derived from this
  42.  * software without specific prior written permission. This software
  43.  * is provided ``as is'' without express or implied warranty.
  44.  *
  45.  *    @@(#)socket.h    7.2 (Berkeley) 12/30/87
  46.  */
  47.  
  48. #ifndef _SOCKET
  49. #define _SOCKET
  50.  
  51. /*
  52.  * Definitions related to sockets: types, address families, options.
  53.  */
  54.  
  55. /*
  56.  * Types
  57.  */
  58. #define    SOCK_STREAM    1        /* stream socket */
  59. #define    SOCK_DGRAM    2        /* datagram socket */
  60. #define    SOCK_RAW    3        /* raw-protocol interface */
  61. #define    SOCK_RDM    4        /* reliably-delivered message */
  62. #define    SOCK_SEQPACKET    5        /* sequenced packet stream */
  63.  
  64. /*
  65.  * Option flags per-socket.
  66.  */
  67. #define    SO_DEBUG    0x0001        /* turn on debugging info recording */
  68. #define    SO_ACCEPTCONN    0x0002        /* socket has had listen() */
  69. #define    SO_REUSEADDR    0x0004        /* allow local address reuse */
  70. #define    SO_KEEPALIVE    0x0008        /* keep connections alive */
  71. #define    SO_DONTROUTE    0x0010        /* just use interface addresses */
  72. #define    SO_BROADCAST    0x0020        /* permit sending of broadcast msgs */
  73. #define    SO_USELOOPBACK    0x0040        /* bypass hardware when possible */
  74. #define    SO_LINGER    0x0080        /* linger on close if data present */
  75. #define    SO_OOBINLINE    0x0100        /* leave received OOB data in line */
  76.  
  77. /*
  78.  * Additional options, not kept in so_options.
  79.  */
  80. #define SO_SNDBUF    0x1001        /* send buffer size */
  81. #define SO_RCVBUF    0x1002        /* receive buffer size */
  82. #define SO_SNDLOWAT    0x1003        /* send low-water mark */
  83. #define SO_RCVLOWAT    0x1004        /* receive low-water mark */
  84. #define SO_SNDTIMEO    0x1005        /* send timeout */
  85. #define SO_RCVTIMEO    0x1006        /* receive timeout */
  86. #define    SO_ERROR    0x1007        /* get error status and clear */
  87. #define    SO_TYPE        0x1008        /* get socket type */
  88.  
  89. /*
  90.  * Structure used for manipulating linger option.
  91.  */
  92. struct    linger {
  93.     int    l_onoff;        /* option on/off */
  94.     int    l_linger;        /* linger time */
  95. };
  96.  
  97. /*
  98.  * Level number for (get/set)sockopt() to apply to socket itself.
  99.  */
  100. #define    SOL_SOCKET    0xffff        /* options for socket level */
  101.  
  102. /*
  103.  * Address families.
  104.  */
  105. #define    AF_UNSPEC    0        /* unspecified */
  106. #define    AF_UNIX        1        /* local to host (pipes, portals) */
  107. #define    AF_INET        2        /* internetwork: UDP, TCP, etc. */
  108. #define    AF_IMPLINK    3        /* arpanet imp addresses */
  109. #define    AF_PUP        4        /* pup protocols: e.g. BSP */
  110. #define    AF_CHAOS    5        /* mit CHAOS protocols */
  111. #define    AF_NS        6        /* XEROX NS protocols */
  112. #define    AF_NBS        7        /* nbs protocols */
  113. #define    AF_ECMA        8        /* european computer manufacturers */
  114. #define    AF_DATAKIT    9        /* datakit protocols */
  115. #define    AF_CCITT    10        /* CCITT protocols, X.25 etc */
  116. #define    AF_SNA        11        /* IBM SNA */
  117. #define AF_DECnet    12        /* DECnet */
  118. #define AF_DLI        13        /* Direct data link interface */
  119. #define AF_LAT        14        /* LAT */
  120. #define    AF_HYLINK    15        /* NSC Hyperchannel */
  121. #define    AF_APPLETALK    16        /* Apple Talk */
  122.  
  123. #define    AF_MAX        17
  124.  
  125. /*
  126.  * Structure used by kernel to store most
  127.  * addresses.
  128.  */
  129. struct sockaddr {
  130.     u_short    sa_family;        /* address family */
  131.     char    sa_data[14];        /* up to 14 bytes of direct address */
  132. };
  133.  
  134. /*
  135.  * Structure used by kernel to pass protocol
  136.  * information in raw sockets.
  137.  */
  138. struct sockproto {
  139.     u_short    sp_family;        /* address family */
  140.     u_short    sp_protocol;        /* protocol */
  141. };
  142.  
  143. /*
  144.  * Protocol families, same as address families for now.
  145.  */
  146. #define    PF_UNSPEC    AF_UNSPEC
  147. #define    PF_UNIX        AF_UNIX
  148. #define    PF_INET        AF_INET
  149. #define    PF_IMPLINK    AF_IMPLINK
  150. #define    PF_PUP        AF_PUP
  151. #define    PF_CHAOS    AF_CHAOS
  152. #define    PF_NS        AF_NS
  153. #define    PF_NBS        AF_NBS
  154. #define    PF_ECMA        AF_ECMA
  155. #define    PF_DATAKIT    AF_DATAKIT
  156. #define    PF_CCITT    AF_CCITT
  157. #define    PF_SNA        AF_SNA
  158. #define PF_DECnet    AF_DECnet
  159. #define PF_DLI        AF_DLI
  160. #define PF_LAT        AF_LAT
  161. #define    PF_HYLINK    AF_HYLINK
  162. #define    PF_APPLETALK    AF_APPLETALK
  163.  
  164. #define    PF_MAX        AF_MAX
  165.  
  166. /*
  167.  * Maximum queue length specifiable by listen.
  168.  */
  169. #define    SOMAXCONN    5
  170.  
  171. /*
  172.  * Message header for recvmsg and sendmsg calls.
  173.  */
  174. struct msghdr {
  175.     caddr_t    msg_name;        /* optional address */
  176.     int    msg_namelen;        /* size of address */
  177.     struct    iovec *msg_iov;        /* scatter/gather array */
  178.     int    msg_iovlen;        /* # elements in msg_iov */
  179.     caddr_t    msg_accrights;        /* access rights sent/received */
  180.     int    msg_accrightslen;
  181. };
  182.  
  183. #define    MSG_OOB        0x1        /* process out-of-band data */
  184. #define    MSG_PEEK    0x2        /* peek at incoming message */
  185. #define    MSG_DONTROUTE    0x4        /* send without using routing tables */
  186.  
  187. #define    MSG_MAXIOVLEN    16
  188.  
  189. #endif /* _SOCKET */
  190. @
  191.  
  192.  
  193. 1.2
  194. log
  195. @Add ifdefs to prevent files from being included multiple times.
  196. @
  197. text
  198. @d156 1
  199. a156 1
  200. #endif _SOCKET
  201. @
  202.  
  203.  
  204. 1.1
  205. log
  206. @Initial revision
  207. @
  208. text
  209. @d15 3
  210. d155 2
  211. @
  212.